<template>
  <el-container class="home-container">
    <!-- 头部区域 -->
    <el-header>
      <div>
        <span>中科院力学所医药费管理系统</span>
      </div>
      <el-button type="info" @click="logout">退出</el-button>
    </el-header>
    <!-- 页面主体区域 -->
    <el-container>
      <!-- 侧边栏 -->
      <el-aside :width="isCollapse ? '64px' : '200px'">
        <div class="toggle-button" @click="toggleCollapse">|||</div>
        <!-- 侧边栏菜单区域 -->
        <el-menu background-color="#373d41" text-color="#fff" active-text-color="#409EFF"
                 :unique-opened="true" :collapse="isCollapse" :collapse-transition="false"
                 :router="true" :default-active="this.$router.history.current.path">
          <!-- 一级菜单 -->
          <el-submenu index="1">
            <!-- 一级菜单的模板区域 -->
            <template slot="title">
              <!-- 图标 -->
              <i class="el-icon-document"></i>
              <!-- 文本 -->
              <span>单据管理</span>
            </template>
            <!-- 二级菜单 -->
            <el-menu-item index= "/ticketsList">
              <template slot="title">
                <!-- 图标 -->
                <i class="el-icon-edit"></i>
                <!-- 文本 -->
                <span>报销单审批</span>
              </template>
            </el-menu-item>
            <el-menu-item index= "/checkedList">
              <template slot="title">
                <!-- 图标 -->
                <i class="el-icon-s-data"></i>
                <!-- 文本 -->
                <span>已审批单据</span>
              </template>
            </el-menu-item>
          </el-submenu>
        </el-menu>
        <el-menu background-color="#373d41" text-color="#fff" active-text-color="#409EFF"
                 :unique-opened="true" :collapse="isCollapse" :collapse-transition="false"
                 :router="true" :default-active="this.$router.history.current.path">
          <!-- 一级菜单 -->
          <el-submenu index="2">
            <!-- 一级菜单的模板区域 -->
            <template slot="title">
              <!-- 图标 -->
              <i class="el-icon-document"></i>
              <!-- 文本 -->
              <span>单据管理</span>
            </template>
            <!-- 二级菜单 -->
            <el-menu-item index= "2-1" >
              <template slot="title">
                <!-- 图标 -->
                <i class="el-icon-edit"></i>
                <!-- 文本 -->
                <span>单据审批</span>
              </template>
            </el-menu-item>
            <el-menu-item index= "2-2" >
              <template slot="title">
                <!-- 图标 -->
                <i class="el-icon-s-data"></i>
                <!-- 文本 -->
                <span>统计报表</span>
              </template>
            </el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <!-- 右侧内容主题 -->
      <el-main>
        <!-- 路由占位符 -->
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
export default {
  data () {
    return {
      // 是否折叠侧边栏
      isCollapse: false
    }
  },
  created () {
  },
  methods: {
    logout () {},
    // 点击按钮切换菜单栏展开与折叠
    toggleCollapse () {
      this.isCollapse=!this.isCollapse
    },
  }
}
</script>
<style lang="less" scoped>
  .home-container {
    height: 100%;
  }
  .el-header {
    background-color: #373d41;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
    font-size: 18px;
  }
  .el-aside {
    background-color: #373d41;
    .el-menu {
      border-right: none;
    }
  }
  .el-main {
    background-color: #eaedf1;
  }
  .toggle-button {
    background-color: #4A5064;
    font-size: 10px;
    line-height: 24px;
    color: #ffffff;
    text-align: center;
    letter-spacing: 0.2em;
    cursor: pointer;
  }
</style>
